Class browser.audio.AudioPlayer
All Packages This Package Previous Next
Class browser.audio.AudioPlayer
java.lang.Object
|
+----java.lang.Thread
|
+----browser.audio.AudioPlayer
-
public class
AudioPlayer
-
extends Thread
This classprovides an interface to play multiple
channels of 8 bit ulaw encoded, 8000hz, single channel audio.
Note that it provides a temporary and very Solaris
specific solution, the APIs are likely to change when this
is generalize to work on different platforms.
To play an audio stream use:
AudioPlayer.player.start(audiostream);
To stop playing an audio stream use:
AudioPlayer.player.stop(audiostream);
To play an audio stream from a URL use:
AudioStream audiostream = new AudioStream(url.openStream());
AudioPlayer.player.start(audiostream);
To play a continuous sound you first have to
create an AudioData instance and use it to construct a
ContinuousAudioDataStream.
For example:
AudoData data = new AudioStream(url.openStream()).getData();
ContinuousAudioDataStream audiostream = new ContinuousAudioDataStream(data);
AudioPlayer.player.stop(audiostream);
-
See Also:
-
AudioData,
AudioDataStream,
AudioStream,
AudioStreamSequence,
ContinuousAudioDataStream
-
Author:
-
Arthur van Hoff
-
Version:
-
1.19, 14 Mar 1995
-
player
-
The default audio player.
-
run()
-
Main mixing loop.
-
start(InputStream)
-
Start playing a stream.
-
stop(InputStream)
-
Stop playing a stream.
player
public final static AudioPlayer player
-
The default audio player. This audio player is initialized
automatically.
start
public synchronized void start(InputStream in)
-
Start playing a stream. The stream will continue to play
until the stream runs out of data, or it is stopped.
-
See Also:
-
stop
stop
public synchronized void stop(InputStream in)
-
Stop playing a stream. The stream will stop playing,
nothing happens if the stream wasn't playing in the
first place.
-
See Also:
-
start
run
public void run()
-
Main mixing loop. This is called automatically when the AudioPlayer
is created.
-
Overrides:
-
run in class Thread
All Packages This Package Previous Next